package com.ymatou.api.sellerpromotion.service;

import java.io.IOException;
import java.util.Map;

import org.apache.http.client.ClientProtocolException;

import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.MapUtil;

/*
 * 根据促销ID、买手ID查询促销详情
 */
public class GetPromotionByIdCall extends YmatouAutoTestCall {
	
	private static String opurl ="/api/Promotion/GetPromotionById";
	
	public GetPromotionByIdCall() {
		super(EnvSetup.getSystemUrl("sellerpromotion_api"),opurl,"GET","PARAM");
	}
	
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public void setData(int sellerId,int PromotionId,Boolean IsShowProducts){
		super.setData("sellerId="+sellerId+"&PromotionId="+PromotionId+"&IsShowProducts="+IsShowProducts);
	}
	
	public void setData(Map<String, Object> paramMap){
		
		String paramStr = "";
		if (paramMap!=null){
			for(String strKey : paramMap.keySet()){
				paramStr = paramStr + "&"+strKey+"="+paramMap.get(strKey);
			}
			paramStr = paramStr.substring(1);
			System.out.print(paramStr);
		}
		super.setData(paramStr);
	}
	
	public static void main(String[] args) throws ClientProtocolException, IOException {
		
/*		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("sellerId", 598283);
		paramMap.put("promotionId", 5134);
		*/
		 new  GetPromotionByIdCall().callAndGetReturnData(MapUtil.hashMap("sellerId", 20323743,"PromotionId", 5244,"IsShowProducts", true));
		//int a = retBea.getJSONObject("Data").get
	}


}
